import request from "@/utils/request";

// 获取分公司列表数据
export function getBranchComList(query) {
  return request({
    url: "pekingFish/sub-tenant/pageSubTenants",
    method: "get",
    params: query,
  });
}

// 获取所有公司列表
export function getAllBusiness(query) {
  return request({
    url: "pekingFish/tenant-config/list-enables",
    method: "get",
    params: query,
  });
}

// 根据企业id查询分公司列表
export function byIdGetBranchCom(query) {
  return request({
    url: "pekingFish/sub-tenant/listByTenantId",
    method: "get",
    params: query,
  });
}

// 新增分公司
export function addBranchComInfo(data) {
  return request({
    url: "/pekingFish/sub-tenant",
    method: "post",
    data: data,
  });
}

// 更新分公司信息
export function updateBranchComInfo(query) {
  return request({
    url: "/pekingFish/sub-tenant",
    method: "put",
    data: query,
  });
}


/**
 * 根据id查询
 * @param tenantId
 * @returns {*}
 */
export function getBranchCompanyByTenantId(tenantId) {
  return request({
    url: '/pekingFish/sub-tenant/listByTenantId?tenantId=' + tenantId,
    method: 'get'
  })
}

// 获取个类型公司列表
export function getCompanyByType(query) {
  return request({
    url: "pekingFish/tenant-config/listByType",
    method: "get",
    params: query,
  });
}